package yun.web.activerecord.ext;

import com.alibaba.fastjson.serializer.JSONSerializer;
import com.alibaba.fastjson.serializer.ObjectSerializer;
import yun.web.activerecord.Record;

import java.io.IOException;
import java.lang.reflect.Type;
import java.util.Map;

/*
  @author 张天笑
  @time 2019/1/24 12:35

 */
public class RecordSerializer implements ObjectSerializer {
    public static RecordSerializer me = new RecordSerializer();
    @Override
    public void write(JSONSerializer jsonSerializer, Object o, Object o1, Type type, int i) throws IOException {
        if (o != null) {
            Record record = (Record) o;
            Map map = record.getColumns();
            jsonSerializer.write(map);
        }
    }
}
